package com.example.demo1.model;

import lombok.*;
import org.hibernate.annotations.Type;
import org.hibernate.validator.constraints.Length;
import org.joda.money.Money;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;

//@Getter
//@Setter
//@NoArgsConstructor
//@AllArgsConstructor
// 反射
@Data
@Table(name = "t_drink")
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity
public class Drink {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer id;// 编号

    @NotBlank
    public String name;// 名称

    @Column
    @Type(type = "org.jadira.usertype.moneyandcurrency.joda.PersistentMoneyAmount",
            parameters = {@org.hibernate.annotations.Parameter(name = "currencyCode", value = "CNY")})
    @NotNull
    public Money price;// 价格

    @ManyToOne
    public Category category; //分类
    //@DateTimeFormat(pattern = "yyyy-MM-dd")
    //public LocalDate enrollDate; // 上架时间

   // public LocalDate startAddDate;// 上架时间-查询开始
   // public LocalDate endAddDate;// 上架时间-查询结束


}
